;----------------- loader & kernel --------------------
;------------------------------------------------------
LOADER_BASE_ADDR     equ  0x900
LOADER_START_SECTOR  equ  0x2

PAGE_DIR_TABLE_POS   equ  0x100000

KERNEL_START_SECTOR  equ  0x9
KERNEL_BIN_BASE_ADDR equ  0x70000
KERNEL_ENTER_ADDR    equ  0xc0001500

PT_NULL              equ  0x0

;------------------------------------------
;-------- gdt description attribute -------
;------------------------------------------
; 23-20 bits
DESC_G_4K      equ   1_00000000000000000000000b
DESC_G_1B      equ   0_00000000000000000000000b
DESC_D_16      equ    0_0000000000000000000000b 
DESC_D_32      equ    1_0000000000000000000000b
DESC_B_SP      equ    0_0000000000000000000000b
DESC_B_ESP     equ    1_0000000000000000000000b
; 64-bit code segment
DESC_L         equ     0_000000000000000000000b
DESC_AVL       equ      0_00000000000000000000b

; 15-8 bits
DESC_P         equ           1_000000000000000b
DESC_DPL_0     equ            00_0000000000000b
DESC_DPL_1     equ            01_0000000000000b
DESC_DPL_2     equ            10_0000000000000b
DESC_DPL_3     equ            11_0000000000000b
DESC_S_SYS     equ              0_000000000000b
DESC_S_CODE    equ              1_000000000000b
DESC_S_DATA    equ              DESC_S_CODE
; Code Excute-Only
DESC_TYPE_Xxxx equ               1000_00000000b
; Data Read/Write
DESC_TYPE_xUWx equ               0010_00000000b
; Data(Stack) Read/Write, expand-down
DESC_TYPE_xDWx equ               0110_00000000b

; in code
DESC_CODE_HIGH4    equ   (0x00<<24) + DESC_G_4K + DESC_D_32 + DESC_L +\
                DESC_AVL + (0xf<<16) + DESC_P + DESC_DPL_0 + \
                DESC_S_CODE + DESC_TYPE_Xxxx + 0x00

DESC_STACK_HIGH4   equ   (0x00<<24) + DESC_G_1B + DESC_B_ESP + DESC_L + \
                DESC_AVL + (0x0<<16) + DESC_P + DESC_DPL_0 + \
                DESC_S_DATA + DESC_TYPE_xDWx + 0x00

DESC_VEDIO_HIGH4   equ   (0x00<<24) + DESC_G_4K + DESC_D_32 + DESC_L +\
                DESC_AVL + (0x0<<16) + DESC_P + DESC_DPL_0 + \
                DESC_S_DATA + DESC_TYPE_xUWx + 0x0b
                
;--------------------------
;-------- selector --------
;--------------------------
RPL0  equ  00b
RPL1  equ  01b
RPL2  equ  10b
RPL3  equ  11b
TI_GDT  equ  000b
TI_LDT  equ  100b

;--------------------------
;----- page attribute -----
;--------------------------
PG_P    equ   1b
PG_RW_R equ   00b
PG_RW_W equ   10b
PG_US_S equ   000b
PG_US_U equ   100b

